<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      /* 强制页面没有横向滚动条 */
      html {
        overflow-x: hidden;
      }
      #color {
        position: relative;
      }
      #threed {
        display: flex;
      }
      #mySpriteSpin1,
      #mySpriteSpin2 {
        display: none;
        width: 100vw;
        /* background-image: url('../../3dbackground.jpg'); */
        background-image: url('../3dbackground.jpg');
        /* background: rgba(0, 247, 255, 0.582); */
        background-color: #fff;
        background-repeat: no-repeat;
        background-size: cover;
      }

      #threed div.active {
        display: block;
      }

      #blue {
        background-color: #a2bbd5;
        left: 45%;
      }

      #black {
        background-color: #565356;
        left: 50%;
      }

      #blue,
      #black {
        width: 3vw;
        height: 3vh;
        position: absolute;
        bottom: 12vw;
        border-radius: 1.5vh;
        box-sizing: border-box;
      }
      #color div.selected {
        border: 5px solid #00b1a9;
        box-shadow: 1px 1px 2px 1px rgb(114, 107, 94);
      }
    </style>
  </head>

  <body>
    <script
      src="https://code.jquery.com/jquery-3.3.1.min.js"
      type="text/javascript"
    ></script>
    <script
      src="https://unpkg.com/spritespin@4.0.11/release/spritespin.js"
      type="text/javascript"
    ></script>
    <div id="threed">
      <div id="mySpriteSpin1" class="active"></div>
      <div id="mySpriteSpin2"></div>
    </div>
    <div id="color">
      <div id="blue" class="selected"></div>
      <div id="black"></div>
    </div>

    <script type="text/javascript">
      //选择颜色显示
      const blue = document.getElementById("blue");
      const black = document.getElementById("black");
      const mySpriteSpin1 = document.getElementById("mySpriteSpin1");
      const mySpriteSpin2 = document.getElementById("mySpriteSpin2");
      blue.onclick = function () {
        //先删除
        document.querySelector(".active").classList.remove("active");
        document.querySelector(".selected").classList.remove("selected");

        //后添加
        mySpriteSpin1.classList.add("active");
        blue.classList.add("selected");
      };
      black.onclick = function () {
        document.querySelector(".active").classList.remove("active");
        document.querySelector(".selected").classList.remove("selected");
        mySpriteSpin2.classList.add("active");
        black.classList.add("selected");
      };
      // 蓝色海豹3d实现
      $("#mySpriteSpin1").spritespin({
        // path to the source images.
        source: [
          "../海豹北冰蓝/hb1.webp",
          "../海豹北冰蓝/hb2.webp",
          "../海豹北冰蓝/hb3.webp",
          "../海豹北冰蓝/hb4.webp",
          "../海豹北冰蓝/hb5.webp",
          "../海豹北冰蓝/hb6.webp",
          "../海豹北冰蓝/hb7.webp",
          "../海豹北冰蓝/hb8.webp",
          "../海豹北冰蓝/hb9.webp",
          "../海豹北冰蓝/hb10.webp",
          "../海豹北冰蓝/hb11.webp",
          "../海豹北冰蓝/hb12.webp",
          "../海豹北冰蓝/hb13.webp",
          "../海豹北冰蓝/hb14.webp",
          "../海豹北冰蓝/hb15.webp",
          "../海豹北冰蓝/hb16.webp",
          "../海豹北冰蓝/hb17.webp",
          "../海豹北冰蓝/hb18.webp",
          "../海豹北冰蓝/hb19.webp",
          "../海豹北冰蓝/hb20.webp",
          "../海豹北冰蓝/hb21.webp",
          "../海豹北冰蓝/hb22.webp",
          "../海豹北冰蓝/hb23.webp",
          "../海豹北冰蓝/hb24.webp",
          "../海豹北冰蓝/hb25.webp",
          "../海豹北冰蓝/hb26.webp",
          "../海豹北冰蓝/hb27.webp",
          "../海豹北冰蓝/hb28.webp",
          "../海豹北冰蓝/hb29.webp",
          "../海豹北冰蓝/hb30.webp",
          "../海豹北冰蓝/hb31.webp",
          "../海豹北冰蓝/hb32.webp",
          "../海豹北冰蓝/hb33.webp",
          "../海豹北冰蓝/hb34.webp",
          "../海豹北冰蓝/hb35.webp",
          "../海豹北冰蓝/hb36.webp",
        ],
        animate: false,
        // frameTime:100,
        width:900 , // width in pixels of the window/frame
        height: 500, // height in pixels of the window/frame
        sense: 1,
        responsive: true,
      });
      // 黑色海豹3d实现
      $("#mySpriteSpin2").spritespin({
        // path to the source images.
        source: [
          "../海豹玄空黑/hbh1.webp",
          "../海豹玄空黑/hbh2.webp",
          "../海豹玄空黑/hbh3.webp",
          "../海豹玄空黑/hbh4.webp",
          "../海豹玄空黑/hbh5.webp",
          "../海豹玄空黑/hbh6.webp",
          "../海豹玄空黑/hbh7.webp",
          "../海豹玄空黑/hbh8.webp",
          "../海豹玄空黑/hbh9.webp",
          "../海豹玄空黑/hbh10.webp",
          "../海豹玄空黑/hbh11.webp",
          "../海豹玄空黑/hbh12.webp",
          "../海豹玄空黑/hbh13.webp",
          "../海豹玄空黑/hbh14.webp",
          "../海豹玄空黑/hbh15.webp",
          "../海豹玄空黑/hbh16.webp",
          "../海豹玄空黑/hbh17.webp",
          "../海豹玄空黑/hbh18.webp",
          "../海豹玄空黑/hbh19.webp",
          "../海豹玄空黑/hbh20.webp",
          "../海豹玄空黑/hbh21.webp",
          "../海豹玄空黑/hbh22.webp",
          "../海豹玄空黑/hbh23.webp",
          "../海豹玄空黑/hbh24.webp",
          "../海豹玄空黑/hbh25.webp",
          "../海豹玄空黑/hbh26.webp",
          "../海豹玄空黑/hbh27.webp",
          "../海豹玄空黑/hbh28.webp",
          "../海豹玄空黑/hbh29.webp",
          "../海豹玄空黑/hbh30.webp",
          "../海豹玄空黑/hbh31.webp",
          "../海豹玄空黑/hbh32.webp",
          "../海豹玄空黑/hbh33.webp",
          "../海豹玄空黑/hbh34.webp",
          "../海豹玄空黑/hbh35.webp",
          "../海豹玄空黑/hbh36.webp",
        ],
        animate: false,
        // frameTime:100,
        width: 900, // width in pixels of the window/frame
        height: 500, // height in pixels of the window/frame
        sense: 1,
        responsive: true,
      });
    </script>
  </body>
</html>
